#include "IImage.h"

namespace SF
{
	class SFBMPImg : public IImage
	{
	public:
		SFBMPImg();
		virtual ~SFBMPImg();
		virtual int Load(const char* szFilename);
		virtual int GetBPP();
		virtual int GetWidth();
		virtual int GetHeight();
		virtual unsigned char* GetImg(void); 
		virtual bool DownSampling(void);
		virtual unsigned char* GetPalette(void);

	protected:
		int GetFile(const char* szFilename);
		int ReadBmpHeader();
		int LoadBmpRaw();
		int LoadBmpRLE8();
		int LoadBmpPalette();
		void Downsampling(void);
		void FlipImg();	
		unsigned char *GetPixel(int x, int y);

	private:
		unsigned int m_uiWidth,m_uiHeight,m_uiEnc;
		short int m_siBPP,m_siPlanes;
		int m_iImgOffset,m_iDataSize;
		unsigned char *m_pucImage;
		unsigned char *m_pucPalette;
		unsigned char *pucData;
	};	
}